Skip to content

[typespec-ts] fix platform import issue for customization#4585

Open
kazrael2119 wants to merge 25 commits into
Azure:mainfrom
kazrael2119:fix-platfor-import
Open

[typespec-ts] fix platform import issue for customization#4585
kazrael2119 wants to merge 25 commits into
Azure:mainfrom
kazrael2119:fix-platfor-import

Conversation

@kazrael2119

Copy link
Copy Markdown
Member

fixes #4581

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:typescript Issues for @azure-tools/typespec-ts emitter label Jun 9, 2026
@azure-sdk

azure-sdk commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-ts
Show changes

@azure-tools/typespec-ts - fix ✏️

[typespec-ts] fix platform import issue for customization

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-ts@4585

commit: 3a11040

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

⚡ Benchmark Results

✅ No performance regressions detected.

Full details – comparing 496175e vs baseline rolling-baseline-364b924-870cafc (rolling baseline (20 main runs))
Metric Baseline Current Change
total 🔴 998.2ms 🔴 756.2ms -24.2% 🟢
loader 🟡 300.6ms 🟡 223.3ms -25.7% 🟢
resolver 🟢 40.0ms 🟢 32.4ms -19.1% 🟢
checker 🟡 360.0ms 🟡 274.8ms -23.7% 🟢
validation 🟢 85.0ms 🟢 66.8ms -21.3% 🟢
 ↳ validation/@azure-tools/typespec-azure-core 🟡 12.4ms 🟢 9.3ms -25.1% 🟢
 ↳ validation/@typespec/http 🟡 15.3ms 🟡 11.4ms -25.4% 🟢
 ↳ validation/@typespec/rest 🟢 1.6ms 🟢 1.3ms -19.7%
 ↳ validation/@typespec/versioning 🔴 51.5ms 🔴 41.5ms -19.4% 🟢
 ↳ validation/compiler 🟢 3.8ms 🟢 3.1ms -18.7%
linter 🟡 212.2ms 🟢 158.6ms -25.2% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/auth-required 🟢 0.1ms 🟢 0.1ms -27.3%
 ↳ linter/@azure-tools/typespec-azure-core/bad-record-type 🟢 0.6ms 🟢 0.5ms -20.2%
 ↳ linter/@azure-tools/typespec-azure-core/byos 🟢 8.2ms 🟢 6.3ms -23.8% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/casing-style 🟢 1.4ms 🟢 1.1ms -20.2%
 ↳ linter/@azure-tools/typespec-azure-core/composition-over-inheritance 🟢 0.2ms 🟢 0.1ms -20.0%
 ↳ linter/@azure-tools/typespec-azure-core/documentation-required 🟢 1.9ms 🟢 1.5ms -20.8%
 ↳ linter/@azure-tools/typespec-azure-core/friendly-name 🟢 1.4ms 🟢 1.0ms -24.2%
 ↳ linter/@azure-tools/typespec-azure-core/key-visibility-required 🟢 0.4ms 🟢 0.3ms -24.6%
 ↳ linter/@azure-tools/typespec-azure-core/known-encoding 🟢 0.5ms 🟢 0.4ms -24.3%
 ↳ linter/@azure-tools/typespec-azure-core/long-running-polling-operation-required 🟢 0.8ms 🟢 0.6ms -22.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-case-mismatch 🟢 0.7ms 🟢 0.5ms -21.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-closed-literal-union 🟢 1.0ms 🟢 0.8ms -21.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-enum 🟢 0.2ms 🟢 0.2ms -16.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-error-status-codes 🟢 0.3ms 🟢 0.2ms -22.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops 🟢 0.2ms 🟢 0.1ms -22.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-format 🟢 0.8ms 🟢 0.6ms -22.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-generic-numeric 🟢 0.8ms 🟢 0.7ms -19.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-header-explode 🔴 26.1ms 🟡 18.9ms -27.8% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-legacy-usage 🟢 2.0ms 🟢 1.6ms -22.2%
 ↳ linter/@azure-tools/typespec-azure-core/no-multiple-discriminator 🟢 0.2ms 🟢 0.2ms -28.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-nullable 🟢 0.4ms 🟢 0.3ms -21.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-offsetdatetime 🟢 1.9ms 🟢 1.5ms -24.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-openapi 🟢 2.3ms 🟢 1.8ms -21.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-private-usage 🟢 3.1ms 🟢 2.4ms -21.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-query-explode 🔴 27.3ms 🟡 19.5ms -28.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-response-body 🔴 32.8ms 🔴 24.8ms -24.3% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-rest-library-interfaces 🟢 0.1ms 🟢 0.1ms -21.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch 🟢 7.5ms 🟢 5.4ms -27.7% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-rpc-path-params 🟢 0.4ms 🟢 0.3ms -24.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-string-discriminator 🟢 0.1ms 🟢 0.1ms -25.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-unknown 🟢 0.3ms 🟢 0.3ms -23.6%
 ↳ linter/@azure-tools/typespec-azure-core/no-unnamed-union 🟢 0.8ms 🟢 0.6ms -21.6%
 ↳ linter/@azure-tools/typespec-azure-core/operation-missing-api-version 🟢 0.4ms 🟢 0.3ms -18.7%
 ↳ linter/@azure-tools/typespec-azure-core/request-body-problem 🟢 0.5ms 🟢 0.4ms -18.0%
 ↳ linter/@azure-tools/typespec-azure-core/require-versioned 🟢 0.1ms 🟢 0.0ms -26.1%
 ↳ linter/@azure-tools/typespec-azure-core/response-schema-problem 🔴 32.2ms 🔴 24.0ms -25.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/rpc-operation-request-body 🟢 0.7ms 🟢 0.5ms -22.9%
 ↳ linter/@azure-tools/typespec-azure-core/spread-discriminated-model 🟢 0.5ms 🟢 0.4ms -22.4%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-names 🟢 7.4ms 🟢 5.4ms -26.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-operations 🟢 0.3ms 🟢 0.2ms -21.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-child-resources 🔴 21.7ms 🟢 9.5ms -56.2% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-lifecycle-operations 🟢 0.3ms 🟢 0.2ms -34.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-common-types-version 🟡 12.0ms 🟢 8.6ms -28.3% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key 🟢 0.2ms 🟢 0.2ms -23.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage 🟢 0.1ms 🟢 0.1ms -19.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes 🟢 5.5ms 🟢 4.2ms -22.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-path-casing-conflicts 🟡 17.0ms 🟡 12.1ms -29.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-record 🟢 0.6ms 🟢 0.5ms -14.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes 🟢 1.4ms 🟢 1.4ms +2.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes 🟢 0.2ms 🟢 0.2ms -27.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment 🟢 0.4ms 🟢 0.3ms -22.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property 🟢 0.4ms 🟢 0.3ms -23.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator 🟢 0.1ms 🟢 0.1ms -21.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb 🟢 0.2ms 🟢 0.1ms -22.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property 🟢 0.3ms 🟢 0.2ms -21.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format 🟢 0.2ms 🟢 0.2ms -20.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars 🟢 0.5ms 🟢 0.4ms -25.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern 🟢 0.1ms 🟢 0.1ms -17.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation 🟢 0.5ms 🟢 0.4ms -21.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response 🟢 8.8ms 🟢 6.8ms -22.3% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-patch 🟢 0.8ms 🟢 0.6ms -25.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars 🟢 0.4ms 🟢 0.3ms -21.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state 🟢 0.4ms 🟢 0.3ms -20.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels 🟢 0.2ms 🟢 0.2ms -21.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/empty-updateable-properties 🟢 0.4ms 🟢 0.3ms -25.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation 🟢 0.1ms 🟢 0.1ms -32.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/lro-location-header 🟡 19.2ms 🟡 13.4ms -30.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint 🟢 0.1ms 🟢 0.1ms -23.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers 🟢 1.0ms 🟢 0.9ms -12.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-empty-model 🟢 0.3ms 🟢 0.2ms -19.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-override-props 🟢 0.3ms 🟢 0.2ms -20.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation 🟢 0.4ms 🟢 0.3ms -26.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-response-body 🔴 29.3ms 🔴 20.6ms -29.5% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/patch-envelope 🟢 0.4ms 🟢 0.3ms -25.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/resource-name 🟢 0.4ms 🟢 0.3ms -26.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/secret-prop 🟢 5.4ms 🟢 4.1ms -24.2% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/unsupported-type 🟢 0.7ms 🟢 0.5ms -20.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/version-progression 🟢 0.3ms 🟢 0.2ms -15.9%
 ↳ linter/@azure-tools/typespec-client-generator-core/property-name-conflict 🟢 2.3ms 🟢 1.7ms -23.8%
 ↳ linter/@azure-tools/typespec-client-generator-core/require-client-suffix 🟢 1.6ms 🟢 1.3ms -21.8%
emit 🔴 5.98s 🔴 4.56s -23.7% 🟢
 ↳ emit/@Azure-Tools 🟢 0.0ms 🟢 0.0ms +0.0%
 ↳ emit/@azure-tools/typespec-autorest 🟢 123.9ms 🟢 95.9ms -22.6% 🟢
 ↳ emit/@azure-tools/typespec-python 🔴 2.23s 🔴 1.69s -24.2% 🟢
 ↳ emit/@typespec 🟢 0.0ms 🟢 0.0ms +0.0%
 ↳ emit/@typespec/http-client-js 🔴 564.9ms 🔴 438.9ms -22.3% 🟢
 ↳ emit/@typespec/openapi3 🟢 106.4ms 🟢 82.5ms -22.5% 🟢
 ↳ emit/@typespec/openapi3/compute 🟢 92.4ms 🟢 71.8ms -22.3% 🟢
 ↳ emit/@typespec/openapi3/write 🟢 13.8ms 🟢 10.5ms -24.0% 🟢

Averaged across 3 specs (azure-arm-resource-manager, azure-core-dataplane, azure-full).
Threshold: changes > ±5% are highlighted.
🟢 Fast · 🟡 Moderate (stages >200ms, rules >10ms) · 🔴 Slow (stages >400ms, rules >20ms)

@azure-sdk

Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

@jeremymeng

Copy link
Copy Markdown
Member

@kazrael2119 maybe as part of this PR, we could get rid of the platform-types source files, and import from @azure/core-rest-pipeline? The type is available now in latest v1.24.0 https://github.com/Azure/azure-sdk-for-js/blob/%40azure/core-rest-pipeline_1.24.0/sdk/core/core-rest-pipeline/review/core-rest-pipeline-node.api.md?plain=1#L239

@JialinHuang803

Copy link
Copy Markdown
Member

Maybe we can remove #platform in this PR after Azure/azure-sdk-for-js#38909.

Comment thread packages/typespec-ts/src/modular/static-helpers-metadata.ts Outdated
Comment thread packages/typespec-ts/src/modular/static-helpers-metadata.ts Outdated
Comment thread packages/typespec-ts/src/rlc-common/metadata/build-package-file.ts Outdated
@kazrael2119 kazrael2119 requested a review from xirzec as a code owner June 29, 2026 08:42
Copilot AI added a commit that referenced this pull request Jul 3, 2026
…expectations

Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com>
Comment thread packages/typespec-ts/src/metadata/build-package-file.ts Outdated
Comment thread packages/typespec-ts/test-next/unit/metadata/package-json.test.ts
});
expect(packageFile.dependencies).to.have.property("@azure-rest/core-client", "^2.7.0");
expect(packageFile.dependencies).to.have.property("@azure/core-rest-pipeline", "^1.24.0");
expect(packageFile.dependencies).to.have.property("tslib", "^2.8.1");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that tslib is already changed to be imported from catalog. Should we change this as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread packages/typespec-ts/test-next/unit/metadata/package-json.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:typescript Issues for @azure-tools/typespec-ts emitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: typespec-ts: multipartHelpers.ts and get-binary-stream-response.ts compilation error in non-standard generation output path

4 participants